<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Django 练习</title>

    <!-- Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<h1>你好，世界！</h1>

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
    添加
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
             <form class="form-inline" action="{% url 'people:index' %}" method="post">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">添加</h4>
            </div>
            <div class="modal-body">

                    {% csrf_token %}
                    <div class="form-group">
                        <label class="sr-only" for="exampleInputEmail3">用户名</label>
                        <input type="text" class="form-control" name="user" id="exampleInputEmail3" placeholder="用户名">
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="exampleInputPassword3">密码</label>
                        <input type="password" class="form-control" name="password" id="exampleInputPassword3"
                               placeholder="密码">
                    </div>
{#                    <button type="submit" class="btn btn-default">提交</button>#}

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button id='submit' type="submit" class="btn btn-primary">添加</button>
            </div>
            </form>
        </div>
    </div>
</div>
<div>
    <table class="table table-hover">
        <tr>
            <th>#</th>
            <th>用户名</th>
            <th>密码</th>
            <th>操作</th>
        </tr>
        {% for u in data %}
            <tr>
                <td>{{ u.id }}</td>
                <td>{{ u.d_user }}</td>
                <td>{{ u.d_pwd }}</td>
                <td>
                    <a class="btn btn-info" href="{% url 'people:up' u.id %} " role="button" uid = {{ u.id }} data-toggle="modal" data-target="#updata_m">改</a>
                    <a class="btn btn-danger" href="{% url 'people:del' u.id %} " role="button" uid = {{ u.id }}>删</a>
                </td>
            </tr>
        {% endfor %}
    </table>
</div>
<div class="modal fade" id="updata_m" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
             <form class="form-inline" action="/" method="post">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title" id="myModalLabel">更新</h4>
            </div>
            <div class="modal-body">

                    {% csrf_token %}
                    <div class="form-group">
                        <label class="sr-only" for="exampleInputEmail3">id</label>
                        <label id="uid"></label>
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="exampleInputEmail3">用户名</label>
                        <input type="text" class="form-control" name="user" id="user_i" placeholder="用户名">
                    </div>
                    <div class="form-group">
                        <label class="sr-only" for="exampleInputPassword3">密码</label>
                        <input type="password" class="form-control" name="password" id="pwd_i"
                               placeholder="密码">
                    </div>
{#                    <button type="submit" class="btn btn-default">提交</button>#}

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button id='submit' type="submit" class="btn btn-primary">添加</button>
            </div>
            </form>
        </div>
    </div>
</div>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="application/javascript">

    $(function(){



});
</script>
</body>
</html>